#!/usr/bin/env python3

# first run the server with
# python manage.py makemigrations && python manage.py migrate && python manage.py runserver

import requests

requests.post(
    "http://127.0.0.1:8000/app/file-test/",
    files={"fieldname": ("foo/bar", open("/home/rasmus/TODO", "rb"))}
)

requests.post(
    "http://127.0.0.1:8000/app/file-test/",
    files={"fieldname": ("../bar", open("/home/rasmus/TODO", "rb"))}
)

requests.post(
    "http://127.0.0.1:8000/app/file-test/",
    files={"fieldname": (r"foo%2fbar", open("/home/rasmus/TODO", "rb"))}
)

requests.post(
    "http://127.0.0.1:8000/app/file-test/",
    files={"fieldname": (r"%2e%2e%2fbar", open("/home/rasmus/TODO", "rb"))}
)

requests.post(
    "http://127.0.0.1:8000/app/file-test/",
    files={"fieldname": (r"foo%c0%afbar", open("/home/rasmus/TODO", "rb"))}
)
